import {request} from '../utils/request'
// const BASE_URL_USER = 'http://dev.basic.lbs.p.yufeiworld.com'
// const BASE_URL_USER = 'http://dev.gateway.lbs.p.yufeiworld.com'
const BASE_URL_USER = ''

export type AdminBasicRoleAdd = {
    accountPassword: number,
    accountPhone: number,
    accountStatus: number,
    accountType: number,
    businessId: number,
    email: string,
    nickname: string
}
// 新增用户
export const requesAdminBasicRoleAdd = (adminBasicRoleAdd: Partial<AdminBasicRoleAdd>) => {
    return request({
        url: BASE_URL_USER + "/admin/basic/role/add",
        method: "POST",
        data: adminBasicRoleAdd
    })
}
export type RoleAssignRoles = {
    accountType: number,
    id: number
}
// 分配角色
export const requesAdminBasicRoleAssignRoles = (roleAssignRoles: Partial<RoleAssignRoles>) => {
    return request({
        url: BASE_URL_USER + "/admin/basic/role/assignRoles",
        method: "PUT",
        data: roleAssignRoles,
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}
export type RoleDelete = {
    id: number
}
// 删除用户
export const requesAdminBasicRoleDelete = (roleDelete: Partial<RoleDelete>) => {
    return request({
        url: BASE_URL_USER + "/admin/basic/role/delete",
        method: "DELETE",
        data: roleDelete,
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}
export type RoleList = {
    accountPhone: string,
    nickname: string,
    pageNo: number,
    pageSize: number
}
// 获取用户列表-分页
export const requesAdminBasicRoleList = (roleList: Partial<RoleList>) => {
    return request({
        url: BASE_URL_USER + "/admin/basic/role/list",
        method: "POST",
        data: roleList
    })
}
export type ResetPassword = {
    id: number
}
// 重置密码
export const requesAdminBasicRoleResetPassword = (resetPassword: Partial<ResetPassword>) => {
    return request({
        url: BASE_URL_USER + "/admin/basic/role/resetPassword",
        method: "PUT",
        data: resetPassword,
        header: {
            'content-Type': 'x-www-form-urlencoded;charset=UTF-8'
        }
    })
}